package com.acegear.horizon.domain.models.jpa;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * Created by wangsike on 2016/12/10.
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserInfo {

    @Column(unique = true)
    private Long userId;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonIgnore
    private Long id;

    @Column
    private String nickname;

    @Column
    private String avatar;

    @Column
    private String background;

    @Column
    private Integer gender;

    @Column
    private String province;

    @Column
    private String title;

    @CreatedDate
    @Column
    private Long createAt;

    @LastModifiedDate
    @Column
    private Long updateAt;

    public UserInfo() {

    }

    public UserInfo(Long userId, String nickname, String avatar, Integer gender, String province) {
        this.userId = userId;
        this.nickname = nickname;
        this.avatar = avatar;
        this.gender = gender;
        this.province = province;
    }

    public UserInfo(Long userId, String nickname, String avatar, Integer gender, String province, String title) {
        this.userId = userId;
        this.nickname = nickname;
        this.avatar = avatar;
        this.gender = gender;
        this.province = province;
        this.title = title;
    }

    public Long getCreateAt() {
        return createAt;
    }

    public Long getUpdateAt() {
        return updateAt;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        if (userId != null) {
            this.userId = userId;
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        if (nickname != null) {
            this.nickname = nickname;
        }
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        if (avatar != null) {
            this.avatar = avatar;
        }
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        if (gender != null) {
            this.gender = gender;
        }
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        if (province != null) {
            this.province = province;
        }
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        if (title != null) {
            this.title = title;
        }
    }

    public String getBackground() {
        return background;
    }

    public void setBackground(String background) {
        this.background = background;
    }
}
